﻿using Ec_System.Bll.Web;
using Ec_System.Models.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ec_System.Facade.Web
{
    public class CustomerComplaintFacade
    {
        CustomerComplaintManager customerComplaintManager = new CustomerComplaintManager();
        /// <summary>
        /// 添加投诉
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddComplaint(CustomerComplaintData model)
        {
            return customerComplaintManager.AddComplaint(model);
        }

        /// <summary>
        /// 获取用户投诉列表 (带分页)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public CustomerComplaintResponseData GetComplaintListWithPage(CustomerComplaintRequestData request)
        {
            return customerComplaintManager.GetComplaintListWithPage(request);
        }

        /// <summary>
        /// 根基ComplaintID获取一条记录, 带明细(回复)
        /// </summary>
        /// <param name="complaintID"></param>
        /// <returns></returns>
        public CustomerComplaintData GetComplaintByID(string complaintID)
        {
            var model = customerComplaintManager.GetComplaintByID(complaintID);
            //获取明细
            model.DetailList = GetComplaintDetailByComplaintID(complaintID);

            return model;
        }

        /// <summary>
        /// 根据 ComplaintID 获取明细
        /// </summary>
        /// <param name="complaintID"></param>
        /// <returns></returns>
        public List<ComplaintDetailData> GetComplaintDetailByComplaintID(string complaintID)
        {
            return customerComplaintManager.GetComplaintDetailByComplaintID(complaintID);
        }

        /// <summary>
        /// 添加一条投诉明细记录(继续投诉)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddComplaintDetail(ComplaintDetailData model)
        {
            return customerComplaintManager.AddComplaintDetail(model);
        }
    }
}
